package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig 视频app沙箱
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 * https://blog.csdn.net/qq_21363853/article/details/116505382
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String appId = "2021000119606723";

	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String privateKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCf1VW318+2cZh7zI9GP9T5a0ZmtT2Elh3XSZfsExj1m+OFDkd7ZXkDjhnhi22Xm5AwlZ5ohhiYtUYt76kz4+cviyAcywEHztLoCnAc+C7RCl04UAB/33H2r8RqDwGTiODlF1N5TrOPRge6DxqXGhCgb8O5kwOXZ4jdJiWnL9H8NpAEL1YoiUC4YoCvgqt3HphkYjPTxg1QaIcb/bfAkp79qg3EqNspEHs5w+w9Jk2IqxSxOWspPro+qDWixGNz6CkBpZrFBdfy9H8v+E2088Mgo3/JBqWXkjSQAsXiszg9MjLF5JvhsE3/sZor1/vjLAeoRoIf0nzTikycx7jgcqzvAgMBAAECggEBAJvvo/B4AfOqgi0OFx5femZY7deYrUsktjprV2f//dLp4yDWHJFcH6ODSObOg/5szFFKN8EcSvT5rl10u6yfhdbRsmPE/t1iQEwYmub4j5xssyQUkVgwZNxbAZLDzzLkUR3REyR/zxlSJom04KlYya3tPJRZxSA658FyzTt+oSyhb0r42ECLfhDFJEsqjToFn5VCPeVz43rR4kFDxN+O/UCQew7vuRvPDWN7Pn6bXUDNVrZvQM8LfEhc3e1sAh53Kag7Lrst2OzGnA4svKMKEPgetLOWVWI2HCC94UympeJ9Lfabgfu9G9W/wTXhC+S+edHD0z827vm4/F6N4rVQujECgYEA+mB7gzcHbTo+gO+/2ZsxL9ZXTDdNP1+CSx89eEWzbH0jj3KwHqSbo0YgTeUvB9IlkwECR7toAoHw97Pmi9U6HEJ5X/cDL7rhu9s0wXj3r+Nq58H+7EpqX5jUyIS/3NWspKGYGYe8wal9kWFWR8n2sCmWrls/xJHGrAko68ztmlkCgYEAo2xH88j+WKy0RK1yu94qhjUkfxrWUmV8KjjGrXOT1Ie/01oBEGxaUUb30Jut0637pi4WZfF5m5Ab0hTEVvzCq0CUrGQ8OTsS8qcv75PxEpgCR1+YLXlT5YOPuQMACPUObIO8ZsauwJhZEuTmFo2bF65bkR29y8n0Qdopm7t/iIcCgYEAirbrlx3kwnIzcNHjU5c0oBE7WmGFLagnkqEjOEA9kMyf5/iddMyz4biXazCfZtDZumEjt0Qv8ru1GjcUcsJWqJN3lWBP5qC+MYrX5pyzdUIk13PWXWk5F++fa9yIQ7wqIyfYEcTvIchaZjIsUCenwZ+4+K5bXPd6v5NvlXx64zkCgYBx2ajS3K7dZgv8YH2zBhbIAtPXPQIcyxjSbVV0VzWg9aWc/3IIWAQf5XoVua9C7k2Hu0ndYXof9yh6lf8mvtZ76fTpmLcgA9iydej+Vim3k3Da+m0RGRpqpdoFwWJP2zFeRfSGAVqTUE+VyyPEiIiI2e5uzbKA+8QP8IXWOayilwKBgC8mp160XQj7NZdU4nGK4SS3d6dWWLuElHXWdYRnuerccaxJXZOZTGhzdilbfTARRGSYsdglkA4KckjyHqOY171UN9tB5RcQTLBFeVYBcKJ4xTV+8dF0IG5wHZYe0yCXuMedZUjZ4Vydt2KD9m12mQhmguWozwFS8M9mvin3Q4pT";

	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoND9tJ5cpcsadhkdMDwooiQYnKeUCIkJV/UESe/mWFz6SPYQORK+l01ev8IWdUMhuD0bPCV8+1IBnXA83MKu+KnXKt4Spg71Z/Ph0LEYw5MoRLJbojqsgHVUBBKeBrOAS7lDWObIEiNdFO/Cw3C88KdyPVEh1tX38jvyjB0wQ0GKZqkaVQ6cdipEYT3o+9L/OBtu+SWoiJ0UfHEhvVG47Fo6y8IvDmP6HhPpG31vlPRdMZCtZpBIX144vUrIUByQqct2eZDK3/k4dZKaIYpv5RIbwSZdRZfro6Khmyce8MJGp5TCB/rvatSThor+xq22mThUcbVVj1yH7WxO/+793wIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://192.168.0.39:8080/alipay/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/alipay/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";

	// 字符编码格式
	public static String charset = "utf-8";

	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

	// 支付宝网关
	public static String log_path = "D:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

//http://localhost:8080/alipay/return_url.jsp?charset=utf-8
//out_trade_no=20221017102416809
//method=alipay.trade.page.pay.return
//total_amount=0.01
//sign=LRsYPMNi99k8%2FMQAFK7e58B4HcddMguo27fGofmP1705misWuqLHBWlQ2uSly5JEMYG1Po5WObLRas1Ujbmfqir9y1NFjaaIJ3ldnVyymSEJ8KB9qhrSjeDhzlOXRsRT2yDwJVb4ShtB0nUVPtLKqIBqHij2ppY1aJIxN5dWVVzeL05EiA1PKaJi23tfh65aZ%2FMz4ribjz5bDJhXEB2P7wZ3q0FAA%2FhcUhfZvyfEq2okoW0ba%2Ba6nbPxnnIQoTS1AxnvdLy19PWnC%2FwGMuRPPpSMXLDVwoUdxMcca7GwFwJ9WY7yrff8qbpDYvm%2BkZjyjQgwYF3ZnU9o8l65mrKc0A%3D%3D
//trade_no=2022101722001477730502200031
//auth_app_id=2021000119606723
//version=1.0
//app_id=2021000119606723
//sign_type=RSA2
//seller_id=2088621957733603
//timestamp=2022-10-17+10%3A25%3A44